<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>E朝朝登录</title>
    <link href="${base}/resources/css/denglu.css" rel="stylesheet">
    <link rel="shortcut icon" href="http://leyikao.cn:80//favicon.ico">
    <script type="text/javascript" src="${base}/resources/js/jquery-1.4.4.js"></script>
	<script type="text/javascript" src="${base}/resources/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="${base}/resources/js/jquery.cookie.js"></script>
	<script type="text/javascript" src="${base}/resources/js/layer/layer.js"></script>
   
</head>

<body>
<div class="header">
    <div class="logo_wrap">
         <h1><a href="${base}/welcome"><img src="${base}/resources/images/logo.png" alt="E朝朝企业版" style="border:none"></a></h1>
    </div>
</div>
<div class="container">
    <div class="content101">
        <div class="content_left101">
            <h1>校招神器神器</h1>
            <h4>校招神器</h4>
            <h2>校招神器神器</h2>
        </div>
        <div class="content_right101">
            <!--登陆注册 开始-->
            <div class="hhh101" >
                <div class="head101">
                    <a href="${base}/enterprise/reg_start" class="zhuce101" id="zhuce" style="background-color: #bec0bc;color: #fff;" >注册</a>
                    <a class="denglu101" id="denglu" onclick="qie()" style="color: #2492ea;">登录</a>
                </div>
                <div class="login101">
                    <ul>
                        <li class="phone101"><span>手机号:</span><input type="text" placeholder="手机号" id="username" onkeyup="this.value=this.value.replace(/\D/g,'')" maxlength='11'></li>
                        <li class="pass101"><span>密&nbsp;码:</span><input type="password" value="" placeholder="输入密码" id="password"  maxlength='16'></li>
                        <li class="yanzh101"><span>验证码:</span><input type="text" placeholder="验证码" id="chkCode">
						<img src="${base}/kaptcha/captcha-image" width="85" height="42" id="kaptchaImage"/>
						<b><a href="javascript:;" onclick="changeVerifyCode();">换一张</a></b></li>
                    </ul>
                    <div class="checkbox101">
                        <ul>
                            <li class="remember101"><span class="checked101"><img src="${base}/resources/images/checked.png"></span><span class="check101" style="display:none;"><img src="${base}/resources/images/check.png"></span>记住我</li>
                            <li class="forgot101"><a style="color:#0089e9;font-size: 12px" href="${base}/enterprise/forgot">忘记密码?</a></li>
                        </ul>
                    </div>
                    <div class="submit101" id="login">
                        <span>登录E朝朝</span>
                    </div>
                </div>

            </div>
            <!--登陆注册 结束-->

        </div>
    </div>
</div>
 <#include "../common/bottom.ftl">
<script>
	var chefuwu=1;
	var index1="";
	  $(function(){
		//从cookie中读取用户名和密码
		if ($.cookie("rmbUser") == "true") {
			$("#username").empty();
			$("#username").val($.cookie("userName"));
		}
           $('#kaptchaImage').click(function () {//生成验证码  
             $(this).hide().attr('src', '${base}/kaptcha/captcha-image?' + Math.floor(Math.random()*100) ).fadeIn(); })      
       });
	    //换一张验证码
     function changeVerifyCode(){
          $("#kaptchaImage").hide().attr('src', '${base}/kaptcha/captcha-image?' + Math.floor(Math.random()*100) ).fadeIn(); 
       }

    $(".checked101").click(function(){
        $(".check101").toggle();
        $(".checked101").toggle();
        chefuwu=0;
    });
    $(".check101").click(function(){
        $(".checked101").toggle();
        $(".check101").toggle();
        chefuwu=1;
    })
    $(document).keydown(function(event){ 
		if(event.keyCode == 13){ //绑定回车 
			 if(index1!=""&&index1!=null){
				   layer.close(index1);
		           index1="";
		     }else{
		    	 $('#login').click(); //自动触发登录按钮 	
		     }
		} 
	}); 
     $("#login").click(function(){
    	var userName = $("#username").val();
	    if(userName == null || userName == ''){
	    	index1 = layer.alert("手机号不能为空!", {icon: 0,skin: 'layer-ext-moon'});
	          $("#userName").focus();
	          return false;
	    }
	    var password = $("#password").val();
	    if(password == null || password == ''){
	    	index1 = layer.alert("密码不能为空!", {icon: 0,skin: 'layer-ext-moon'});
	           $("#password").focus()
	           return false;
	    }
	    var chkCode = $("#chkCode").val();
	    if(chkCode == null || chkCode == ''){
	    	index1 = layer.alert("验证码不能为空!", {icon: 0,skin: 'layer-ext-moon'});
	           $("#chkCode").focus()
	           return false;
	    }
	    if (chefuwu==1) { //记住用户名和密码
	    	$.cookie("rmbUser", "true", { expires: 7 }); //存储一个带7天期限的cookie 
	    	$.cookie("userName", userName, { expires: 7 }); 
	    }else{
	    	$.cookie("rmbUser", "false", { expire: -1 }); 
	    	$.cookie("userName", "", { expires: -1 }); 
	    }
	    
	    $.post('${base}/enterprise/verifyLogin',{
			'userName':userName,
			'password':password,
			'chkCode':chkCode
		},function(data){
			if(data.result==1){
				location.href= "${base}/welcome";
			}else{
				index1 = layer.alert(data.message, {icon: 0,skin: 'layer-ext-moon'});
			}
			
		});
    })
     function upperCase(){
    	 var phone = $("#phone").val();
    	 var flag=true;
    	 var chephone =/1[34578]{1}\d{9}$/;
			if(!chephone.test(phone)){
				index1 = layer.alert("请输入正确的手机号!", {icon: 0,skin: 'layer-ext-moon'});
				flag =false;
			}
			return flag;
     }

</script>
</body>
</html>